//Main
app.controller('mainController',["$scope","$rootScope","shareFactory","userInfoService", function($scope,$rootScope,shareFactory,userInfoService) {
    $rootScope.loading = false;  //加载

    $rootScope.prefix = "/";

    $rootScope.userInfoData = {};

    userInfoService.userInfo(function(data){
        var url;
        $rootScope.userInfoData = data.data;

        if(location.href.indexOf('promote_code') > -1){
            url = location.href.replace(/promote_code=Izc(=)*/g,"promote_code="+ data.data.myPromoteCode)
        }else{
            url = location.href + '?promote_code=' + data.data.myPromoteCode
        }

        shareFactory({
            link : url
        });
    });

}]);
